var express = require('express');
var loginRouter = express.Router();
var db = require('../config/sq')

/* 注册. */
loginRouter.post('/', async(req, res, next)=> {
    console.log('req.body',req.body);
    const val=req.body;
    const userName=val.userName;
    const passWord=val.passWord;
    const [rows={},fields]=await db.query(`insert into users (name,password) values (?,?) `,[userName,passWord])
    console.log('rows',rows);
    if(rows){
        res.send({data:true,msg:'成功',code:'0'})
    }else{
        res.send({data:false,msg:'失败',code:'1'})
    }
});

module.exports = loginRouter;
